/*
 * Copyright 2016-2036 the original author or authors.
 *
 * COMMERCIAL USE OF THIS SOFTWARE WITHOUT WARRANTY IS NOT ALLOWED.
 * Use is subject to license terms! You can distribute a copy of this software
 * to others for free. This software is a non-profit and open-source project.
 * Any contribution to this project will make it better.
 * All rights reserved! Owned by Stephen Liu.
 *
 */
package com.github.raffle.creation.prototype;


import java.util.ArrayList;

/**
 * @author ste7en.liu@gmail.com
 * @since 2016/5/3
 */
public class Prototype implements Cloneable {

    private String name;
    private ArrayList<String> list = new ArrayList<>();

    public Prototype(String name) {
        this.name = name;
        list.add(name);
    }

    public void setName(String name) {
        list.add(name);
    }

    public ArrayList<String> getList() {
        return list;
    }

    @Override
    public Prototype clone() {
        Prototype prototype = null;
        try {
            prototype = (Prototype)super.clone();

            //深克隆
            prototype.list = (ArrayList<String>) list.clone();
        } catch (CloneNotSupportedException e) {

        }
        return prototype;
    }
}
